FAQ

  1. Where does Quilt fit in the testing cycle?
  2. Do Quilt/JUnit tests run concurrently?
  3. What is the connection between JUnit's assertions and Java asserts?

Where does Quilt fit in the testing cycle?

After your unit tests. Coverage tests are run when you are satisfied that your software under development passes all its tests. You then run Quilt, which lets you know how thorough that testing has been.

Quilt can also be quite useful in integration tests, where it can track exactly how modules call one another in actual use.

Do Quilt/JUnit tests run concurrently?

No, at least not because of JUnit or Quilt. Each test is started by JUnit. It runs and the results are collected, then the next test is started. Quilt loads classes and provides a report at the end. All of this is fully serialized.

If the tests themselves are multi-threaded, standard JUnit has no way of knowing this, so the results are unpredictable. If the unit that JUnit started returns, JUnit will not wait for any threads to complete. It just starts the next test.

On the other hand, if you need to run multithreaded tests, you can find help in the standard JUnit distribution: junit.extensions.ActiveTestSuite. This class, an extension to TestSuite , runs each test in a separate thread and waits until all have terminated. However, even in this case each test must either be single-threaded or handle its own concurrency correctly.

What is the connection between JUnit's assertions and Java asserts?

There isn't any. Earlier versions of JUnit had an assert method. When Sun introduced assert as a keyword in the Java lanaguage, JUnit had to rename its method to assertTrue . assert is part of the language; assertTrue is a method that throws a JUnit-defined exception.


This material is copyright 2003 by James David Dixon ("Jim Dixon") and is made available under the Artistic License .